package
{
	import com.util.TestButton;
	
	import flash.display.Sprite;
	
	import leaf.science.Global;
	import leaf.science.ui.demoplayer.DemosPlayer;
	import leaf.science.ui.rightmenu.RightMenu;

	[SWF(frameRate="30", backgroundColor="#ECECEC", width="900", height="600")]
	public class Test2 extends Sprite
	{
		
		public var demosPlayer:DemosPlayer;
		public var rightMenu:RightMenu;
		
		public function Test2()
		{
			var openBtn:TestButton = new TestButton('Test');
			addChild(openBtn);
			openBtn.onClick = onTest;
			
			rightMenu = new RightMenu('Choose a Demo');
			rightMenu.x = 450;
			rightMenu.y = 300;
			addChild(rightMenu);
			
			var data:Array = [];
			for each (var item:XML in Global.DATA_DEMOS.demo){
				data.push({id:uint(item.id), title:item.title.toString()});
			}
			
			rightMenu.data = data;
			
			
			demosPlayer  = new DemosPlayer();
			demosPlayer.x = 450;
			demosPlayer.y = 300;
			addChild(demosPlayer);
			
			demosPlayer.title = 'Asdfds';
			demosPlayer.source = 'collapsible_viewfinder.flv';
			
		}
		
		private function onTest ():void
		{
			if (!rightMenu.isOpen) rightMenu.open()
			else rightMenu.close();
//			if (!demosPlayer.isOpen) demosPlayer.open()
//			else demosPlayer.close();
		}
		
	}
}